<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        /* 编写函数has(arr , n) 判断数组中是否存在60这个元素，
        返回布尔类型*/

        function has(arr, n) {
            var flag = false;
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] === n) {
                    flag = true;
                    break;
                }
            }
            return flag;
        }
        var arr = [1, 2, 3, 60];
        var arr1 = [1, 2, 3];
        console.log(has(arr, 60));
        console.log(has(arr1, 60))

    </script>
</body>

</html>